package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.ServiceBean;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;
import com.fancy.learncenter.ui.callback.ServiceImp;
import com.fancy.learncenter.utils.PermissionHelper;

import java.util.List;

/**
 * Created by sww on 2017/3/16 15:20.
 */

public class ServiceAdapter extends CommonRecycleViewAdapter<ServiceBean.ResultBean>{
    Context mContext;
    ServiceImp listener;
    public ServiceAdapter(Context mContext, List<ServiceBean.ResultBean> itemDatas, ServiceImp listener) {
        super(mContext, R.layout.service_item, itemDatas);
        this.mContext = mContext;
        this.listener = listener;
    }

    @Override
    public void bindView(CustomViewHold customViewHold, final ServiceBean.ResultBean item, int position) {

        TextView phoneText = customViewHold.getView(R.id.phone_text);
        TextView callText = customViewHold.getView(R.id.call_text);
        TextView emailText = customViewHold.getView(R.id.email_text);
        TextView companyText = customViewHold.getView(R.id.company_text);
        companyText.setText(item.getOrganizationName());
        emailText.setText(item.getOrganizationEmail());
        phoneText.setText(item.getOrganizationPhone());
        callText.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (listener != null){
                    listener.onClick(item.getOrganizationPhone());
                }


            }
        });
    }
}
